
// 2. Overwrite the keyboard shortcuts
import { Extension } from '@tiptap/core'

const Customkeys = Extension.create({
  addCommands() {
    return {
      customAction: () => ({ commands }) => {
        // 执行自定义操作
        return true
      }
    }
  },
  //自定义键盘插件 Mod == ctrl 
  addKeyboardShortcuts() {
    return {
      'Mod-l': () => this.editor.commands.toggleBlockquote(),
      'Mod-q': () => this.editor.commands.toggleCodeBlock(),
      'Mod-w': () => this.editor.commands.toggleCode(),
      'Mod-1': () => this.editor.commands.toggleHeading({level:1}),
      'Mod-2': () => this.editor.commands.toggleHeading({level:2}),
      'Mod-3': () => this.editor.commands.toggleHeading({level:3}),
      'Mod-4': () => this.editor.commands.toggleHeading({level:4}),
    }
  }
})



export {Customkeys }